package com.demo.simpletestapp.dptest

import android.content.res.Resources
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.demo.simpletestapp.R
import com.demo.simpletestapp.databinding.ActivityDensityTestBinding
import com.demo.simpletestapp.utils.DensityUtils
import com.demo.simpletestapp.utils.ScreenUtil
import com.example.base_lib.BaseActivity

class DensityTestActivity : BaseActivity<ActivityDensityTestBinding>() {

    override fun getLayoutId(): Int {
        return R.layout.activity_density_test
    }

    override fun onInit() {
        DensityUtils.getDensity(this)
        binding.img.layoutParams.height = DensityUtils.getDimension(R.dimen.windows_width).toInt()
//        binding.img.layoutParams.height = resources.getDimension(R.dimen.windows_width).toInt()
        binding.img.requestLayout()

        Log.d(TAG, "onInit: width=${ScreenUtil.getScreenWidth(this)}")
        Log.d(TAG, "onInit: height=${ScreenUtil.getScreenHeight(this)}")
    }
}